Repository navigation
Make a resource budget's disk limit optional (contract 2.6) - #159
Conversation
ResourceLimits.disk_bytes was a required u64 defaulting to 8 GiB, and an explicit native jail budget turned it into a hard Disk requirement that no backend enforces, so every legacy jail request with resources was refused. disk_bytes is now Option<u64>, absent by default and on the wire when unset. A native jail requires Disk only when the caller sets one; a box keeps the soft core default. Contract 2.6, since a module before it cannot decode a budget without the field.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): Make a resource budget's disk limit optional (contract 2.6). Under contract 2.6, `ResourceLimits::disk_bytes` becomes an optional `Option<u64>` that defaults to `None` and is omitted on the wire, so a native jail asks for `Disk` only when a caller set a budget; a CPU/memory/pids request now reaches backends able to hold those three constraints instead of being refused for a disk limit nothing enforces. `Create` keeps the soft core `Resources::DEFAULT.disk_bytes` when the field is unset, and `CONTRACT_VERSION` moves to (2,6), which is the gate making the omission decodable only against a 2.6 module. The diff is stacked on contract 2.5 work the description says to review separately. Review snapshot
Completeness: Complete What changed`ResourceLimits::disk_bytes` changes from a required `u64` defaulting to 8 GiB into `Option<u64>` with `#[serde(default, skip_serializing_if = "Option::is_none")]` and a `None` default; `CONTRACT_VERSION` becomes (2,6) and `is_compatible` now rejects (2,5). Callers map the field through `unwrap_or(Resources::DEFAULT.disk_bytes)` in both `make_spec` and `configure_resources`, while `required_resource_constraints` adds `Constraint::Disk` only when a budget is set. Tests are updated to the new `Some(...)` shape and to pin (2,6); a new `docs/specs/contract-2-6.md` documents the optional field, the soft `Create` default, the Disk-only-when-set native jail behavior, and the host rule requiring a bound 2.6 module before omitting the field. Features
Tests
FindingsNo active actionable findings. Before mergeNone. How this fits togetherflowchart LR
n0["...p_their_correlation_and_signal_wire_shape<br/>changed"]:::changed
n1["..._limits_are_optional_typed_and_round_trip<br/>changed"]:::changed
n2["ResourceLimits<br/>changed"]:::changed
n3["...ker_facts_are_additive_and_default_safely<br/>changed"]:::changed
n4["...wire_shape_contains_only_structural_facts<br/>changed"]:::changed
n5["configure_resources<br/>changed"]:::changed
n6["ResourceId"]:::impacted
n7["clone"]:::impacted
n8["...d_descendants_and_preserves_stream_events"]:::impacted
n9["CreateRequest"]:::impacted
n10["prepare"]:::impacted
n11["tempdir"]:::impacted
n0 -->|calls| n6
n0 -->|tests| n6
n1 -->|calls| n7
n1 -->|tests| n7
n3 -->|calls| n6
n3 -->|tests| n6
n3 -->|uses| n9
n4 -->|calls| n7
n4 -->|tests| n7
n8 -->|calls| n7
n8 -->|tests| n7
n8 -->|calls| n11
n8 -->|tests| n11
n9 -->|uses| n2
n9 -->|uses| n6
n10 -->|calls| n5
n11 -->|calls| n7
classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
# Conflicts: # crates/tinybox-module/src/tinybus_module/native_jail_tests.rs
Summary
ResourceLimits.disk_byteswas a requiredu64defaulting to 8 GiB. No backend enforces a writable disk budget, so onCreatethe value was never applied. On a native jail, an explicitresourcesbudget made all four fields hard requirements, Disk included, and every backend refused. So everyStartJailedExecrequest carrying resources was refused, whatever its CPU, memory and pids.Contract 2.6 makes
disk_bytesanOption<u64>:Noneby default, and omitted on the wire whenNone.disk_bytesis set, so a CPU/memory/pids budget is judged on what it asks for.Stacked on #158 (contract 2.5); review only the last commit.
Related issue
Part of #27 (enforcement gaps: the mandatory disk budget).
API or behavior changes
tinybox_bus::ResourceLimits::disk_byteschanges fromu64toOption<u64>, andResourceLimits::default()now hasNone. This is source-breaking for code that builds the struct literally or reads the field.CONTRACT_VERSION= (2, 6).ResourceLimitswithoutdisk_bytes. A host must have bound a 2.6 module, whichis_compatiblealready requires of a 2.6 host, before it sends one. A host built on 2.6 that talks to older modules must keep settingdisk_bytes.disk_bytesis no longer refused for Disk. It is still refused by any backend that cannot enforce CPU, memory and pids.Resourcesand stored box records are unchanged.Validation
On our Linux CI runner, at 121446c7a9. The head is the same commit rebased onto #158's final formatting fix, and
cargo fmt --checkon the head is clean:cargo clippy --all-targets --all-features -- -D warnings: 0 errors, same as main.cargo build --all-targets --all-featuresandRUSTDOCFLAGS="-D warnings" cargo doc: ok.cargo test --locked --all-features --workspace --no-fail-fast: 1589 passed, 0 failed, with no failures unique to this branch (main: 1575 passed). The version tests pin (2, 6).a_native_jail_budget_requires_disk_only_when_one_is_set;disk_bytes_is_optional_and_absent_by_default, becauseNonethen serializes asnull.Tests
disk_bytes_is_optional_and_absent_by_default:disk_bytesdecodes asSomeand re-encodes unchanged;None;a_native_jail_budget_requires_disk_only_when_one_is_set: Cpu, Memory and Pids are always required; Disk only when set.an_unset_disk_budget_keeps_the_soft_core_default: aCreatewithout a disk budget keepsResources::DEFAULT.disk_bytesand adds no hard requirement.Documentation
docs/specs/contract-2-6.md, the contract version doc intinybox-bus/src/lib.rs, and rustdoc on the field.Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description